<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
  <th:block th:include="include :: header('展会名单列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
  <div class="row">
    <div class="col-sm-12 search-collapse">
      <form id="eventRoster-form">
        <div class="select-list">
          <ul>
            <li>
              展会分类：<select id="sortId" name="sortId">
              <option value="">所有</option>
              <option th:each="post:${eventSort}" th:value="${post.sortId}" th:text="${post.sortName}"></option>
            </select>
            </li>
            <li>
              名单名称：<input type="text" name="eventName"/>
            </li>
            <li class="select-time">
              <label>展会时间： </label>
              <input type="text" class="time-input" id="startTime" placeholder="开始时间" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss" name="params[beginTime]"/>
              <span>-</span>
              <input type="text" class="time-input" id="endTime" placeholder="结束时间" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss" name="params[endTime]"/>
            </li>
            <li>
              <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
              <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
            </li>
          </ul>
        </div>
      </form>
    </div>

    <!--    <div class="btn-group-sm" id="toolbar" eventRoster="group">-->
    <!--      <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:eventRoster:add">-->
    <!--        <i class="fa fa-plus"></i> 新增-->
    <!--      </a>-->
    <!--      <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:eventRoster:edit">-->
    <!--        <i class="fa fa-edit"></i> 修改-->
    <!--      </a>-->
    <!--      <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:eventRoster:remove">-->
    <!--        <i class="fa fa-remove"></i> 删除-->
    <!--      </a>-->
    <!--    </div>-->

    <div class="col-sm-12 select-table table-striped">
      <table id="bootstrap-table"></table>
    </div>
  </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
  var editFlag = [[${@permission.hasPermi('system:event:edit')}]];
  var removeFlag = [[${@permission.hasPermi('system:eventRoster:remove')}]];
  var prefix = ctx + "system/event";


  $(function() {
    var options = {
      url: prefix + "/list",
      createUrl: prefix + "/add",
      updateUrl: prefix + "/edit/{id}",
      removeUrl: prefix + "/remove",
      exportUrl: prefix + "/export",
      sortName: "regionId",
      modalName: "展会首页",
      columns: [{
        checkbox: true
      },
        {
          field: 'regionId',
          title: '展会名单编号'
        },
        {
          field: 'sortName',
          title: '展会分类名称'
        },
        {
          field: 'eventName',
          title: '展会名单名称'
        },
        {
          field: 'eventProfiles',
          title: '展会简介'
        },
        {
          field: 'eventAddress',
          title: '展会地址'
        },
        {
          field: 'startTime',
          title: '开始时间'
        },
        {
          field: 'endTime',
          title: '结束时间'
        },
        {
          field: 'eventNum',
          title: '摊位总编号'
        },
        {
          title: '操作',
          align: 'center',
          formatter: function(value, row, index) {
            var actions = [];
            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit(\'' + row.regionId + '\')"><i class="fa fa-edit"></i>申请</a> ');
            // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.rosterId + '\')"><i class="fa fa-remove"></i>删除</a> ');
            return actions.join('');
          }
        }]
    };
    $.table.init(options);
  });

  function edit(regionId) {
    $.modal.confirm("确定申请该展会摊位吗？", function() {
      var data = { "regionId": regionId };
      $.operate.post(prefix + "/edit", data);
    });
  }
</script>
</body>
</html>